<%@ page language="java" contentType="text/html; charset=utf-8"  pageEncoding="utf-8"%>
 <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
 <%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<jsp:include page="/common/commonCss.jsp"/>
<jsp:include page="/common/commonJs.jsp"/>
<script src="${basePath}commonJs/jquery.ztree.all.js"></script>
<script language="javascript" src="${basePath}commonJs/tags/My97DatePicker/WdatePicker.js"></script>
<script  type="text/javascript" src="${basePath }commonJs/ajaxfileupload.js"></script>
<script src="${basePath}commonJs/jquery.imageScroller.js"></script>
<title>嘉童游乐中心-新增商品信息</title>
<SCRIPT type="text/javascript">
		var resverseType="";
		$(document).ready(function() {
			getData();
		 });
		//初始化页面修改的数据
		function initData(result){
				if(result.prdStatus=="2"){
					$("#statusOne").val("停用");
				}else{
					$("#statusOne").val("启用");	
				}
				$("#prdId").val(result.pkPrdId);
				$("#prdName").val(result.prdName);
				$("#cateName").val(result.cateName);
				$("#comments").val(result.comments);
		}
		function getData(){
			 resverseType=$("#resverseType").val();
			var pkPrdId=$("#pkPrdId").val();
			$.ajax({
				url:"${basePath}scmInvocing/productInfo/findProductById.shtml",
				dataType:"json",
				type:"post",
				data:{"resverseType":resverseType,"pkPrdId":pkPrdId},
  	 			async:true,
  	 			error : function(XMLHttpRequest) {
  	 				ajaxError(XMLHttpRequest);
  	 			},
  	 			success:function(result){
  	 					showData(resverseType,result);
  	 			}
		});
		}
		
		function showData(resverseType,result){
				var html="";
				var entity=result.entity;
				var unit=result.unit;
				trimJson(entity);
				initData(entity);
				$("#dynamic").html(html);
				if(resverseType=="1"){
					html+='<div id="singleTicked">';
            		html+='<dl class="fixed" style="overflow:hidden">';
	            	html+='<dd><label> 儿童数量：</label>';
            		if(entity.chdCnt==0){
						html+='<input type="text" class="iput_t w200"      disabled="disabled"   value="0">';
            		}else{
						html+='<input type="text" class="iput_t w200"      disabled="disabled"   value="1">';
            		}
	                html+='<font color="#FF0000"></font></dd></dl>';        
	             	html+='<dl class="fixed" style="overflow:hidden">';
	            	html+='<dd><label>监护人数量：</label>';
	             	if(entity.guaCnt==0){
						html+='<input type="text" class="iput_t w200"      disabled="disabled"   value="0">';
	             	}else{
						html+='<input type="text" class="iput_t w200"      disabled="disabled"   value="1">';

	             	}
	                html+='<font color="#FF0000"></font> </dd></dl></div>';
				}else if(resverseType=="2"){
					html+='<div id="huijiGoods">';
					html+='<dl class="fixed" style="overflow:hidden">';
					html+='<dd><label>商品周期：</label>';
					if(entity.month==6){
						html+='<input type="text" class="iput_t w200"      disabled="disabled"   value="6个月">';
					}else if(entity.month==12){
						html+='<input type="text" class="iput_t w200"      disabled="disabled"   value="12个月">';
					}
					html+='<font color="#FF0000"></font></dd></dl>';
					html+='<dl class="fixed" style="overflow:hidden">';
					html+=' <dd><label>使用范围：</label>'; 
					if(entity.weekday=="1,2,3,4,5"){
						html+='<input type="text" class="iput_t w200"      disabled="disabled"   value="工作周票(周一到周五)">';
					}else{
						html+='<input type="text" class="iput_t w200"      disabled="disabled"   value="全周票">';
					}
					html+='<font color="#FF0000"></font></dd></dl>';
					html+='<dl class="fixed" style="overflow:hidden">';
					html+='<dd><label>允许入场的监护人数量：</label> ';
					if(entity.guaCnt==0){
						html+='<input type="text" class="iput_t w200"      disabled="disabled"   value="0">';
					}else{
						html+='<input type="text" class="iput_t w200"      disabled="disabled"   value="1">';
					}
					html+='<font color="#FF0000"></font> </dd></dl></div>';
				}else if(resverseType=="3"||resverseType=="4"){
					html+=' <div id="paiOrTeam"><dl class="fixed" style="overflow:hidden">';
					html+='<dd><label>使用范围：</label>';
					if(entity.weekday=="1,2,3,4,5"){
						html+='<input type="text" class="iput_t w200"      disabled="disabled"   value="工作周票(周一到周五)">';
					}else{
						html+='<input type="text" class="iput_t w200"      disabled="disabled"   value="全周票">';
					}
			        html+='<font color="#FF0000"></font></dd></dl>';
			        if(resverseType=="3"){
				        html+='<dl class="fixed" style="overflow:hidden;" id="pai">';
				        html+='<dd><label id=""> 派队持续时间：</label><input type="text" class="iput_t w200"      disabled="disabled"   value="2小时">';
				        html+='<font color="#FF0000"></font> </dd></dl>';     
			        }else{
			        		 html+='<dl class="fixed" style="overflow:hidden;display:block" id="team">';
					     	html+='<dd><label id=""> 团体持续时间：</label>';
					     	if(entity.hours==2){
					     		html+='<input type="text" class="iput_t w200"      disabled="disabled"   value="2小时">';		
					     	}else if(entity.hours==4){
					     		html+='<input type="text" class="iput_t w200"      disabled="disabled"   value="4小时">';		
					     	}else if(entity.hours==6){
					     		html+='<input type="text" class="iput_t w200"      disabled="disabled"   value="6小时">';		
					     	}
					        html+='<font color="#FF0000"></font> </dd></dl>';
			        }
			        html+='<dl class="fixed" style="overflow:hidden">';
			        html+='<dd><label>是否含餐：</label> ';
			        if(entity.incFood=="1"){
			     		html+='<input type="text" class="iput_t w200"      disabled="disabled"   value="是">';		
			        }else{
			     		html+='<input type="text" class="iput_t w200"      disabled="disabled"   value="否">';		
			        }
			        html+='<font color="#FF0000"></font> </dd></dl></div>';
				}else if(resverseType=="5"){
					var dateFmt="'yyyy/MM/dd HH:mm:00'";
					html+='<div id="activityGoods" >';
				   	html+='<dl class="fixed"  style="overflow:hidden">';
					html+='<dd><label>开始时间：</label>';
		           	html+='<input type="text"   id="startTime"   disabled="disabled"   value="'+entity.startTime+'"  class="Wdate iput_t w200"  name="startTime" onclick="WdatePicker({dateFmt:'+dateFmt+',isShowWeek:true,isShowClear:true,readOnly:true})">';
		           	html+='<font color="#FF0000"></font></dd></dl>';
		          	html+='<dl class="fixed"  style="overflow:hidden">';
		           	html+='<dd><label>结束时间：</label>';
		           	html+='<input type="text" id="endTime" class="Wdate iput_t w200"  disabled="disabled"   value="'+entity.endTime+'"  name="endTime" onclick="WdatePicker({dateFmt:'+dateFmt+',isShowWeek:true,isShowClear:true,readOnly:true})" >';
		           	html+='<font color="#FF0000"></font></dd></dl></div>';
				}else if(resverseType=="6"||resverseType=="7"||resverseType=="8"||resverseType=="9"||resverseType=="11"
					||resverseType=="12"||resverseType=="13"||resverseType=="61"||resverseType=="61"){
					html+='<div id="unitAndRule"><dl class="fixed" style="overflow:hidden">';
					html+='<dd><label>计量单位：</label>';
					html+='<input type="text" class="iput_t w200"   disabled="disabled"    value='+entity.unitName+' >';
					html+='<font color="#FF0000"></font></dd></dl></div>';
		            html+='<dl class="fixed" style="overflow:hidden">'; 
		            html+='<dd><label>规格：</label><input type="text" class="iput_t w200"  disabled="disabled"   name="prdSpec"  id="prdSpec" value='+entity.prdSpec+' ><font color="#FF0000"></font></dd></dl></div>';
		            html+='<div id="commonGoods"><dl class="fixed" style="overflow:hidden">';
		          	//商品图片处理
		            html+='<div class="invo_img" style="right: 350px;top: 30px;"><img width="176" height="176" src="${basePath}common/getImageByAttfile.shtml?attfileId='+entity.fkPicFile+'&random=' + Math.random() + '"></div>';
		            html+='<dl class="fixed" style="overflow:hidden">';
		            html+='<dd><label>最低库存量：</label><input type="text" class="iput_t w200"   name="minStorage"  onblur="checkIsNumber(this);"  id="minStorage"   disabled="disabled"   value='+entity.minStorage+'><font color="#FF0000"></font></dd></dl></div>';
				}else if(resverseType=="10"){
					var actionFmt="'yyyy/MM/dd'";
					html+='<div id="kcsp"><dl class="fixed" style="overflow:hidden">';
					html+='<dd><label>次数：</label> <input type="text"  name="cnt" id="cnt"  disabled="disabled"   value='+entity.cnt+' class="iput_t w200">';
					html+='<font color="#FF0000"></font></dd></dl>';
					html+='<dl class="fixed"  style="overflow:hidden"><dd><label>有效时间：</label>';
					html+='<input type="text"   id="startTime" class="Wdate iput_t w90"  name="startTime"  disabled="disabled"   value='+entity.actStartTime+' onclick="WdatePicker({dateFmt:'+actionFmt+',isShowWeek:true,isShowClear:true,readOnly:true})">';
					html+='至<input type="text" id="d13" class="Wdate iput_t w90" name="endTime"  disabled="disabled"   value='+entity.actEndTime+'  onclick="WdatePicker({dateFmt:'+actionFmt+',isShowWeek:true,isShowClear:true,readOnly:true})" >';
	                html+='</dd></dl></div>';
				}else if(resverseType=="20"){
					html+='<div id="unitAndRule"><dl class="fixed" style="overflow:hidden">';
					html+='<dd><label>计量单位：</label>';
					html+='<input type="text" class="iput_t w200"   disabled="disabled"    value='+entity.unitName+' >;'
					html+='<font color="#FF0000"></font></dd></dl></div>';
		            html+='<dl class="fixed" style="overflow:hidden">'; 
		            html+='<dd><label>规格：</label><input type="text" class="iput_t w200"  name="prdSpec"  id="prdSpec"  disabled="disabled"    value='+entity.prdSpec+' ><font color="#FF0000"></font></dd></dl></div>';
				}
				$("#dynamic").html(html);
				//刷新select
				refreshSelect();
		}
	//跳转到商品列表中
	function forwardToList(){
				window.location.href="${basePath}scmInvocing/productInfo/forwardToProductInfo.shtml";
	}

	</SCRIPT>
</head>
<body class="bg">
<div class="content m_auto">
	<div class="content_l mt10">
    	<ul>
    		<shiro:hasPermission name="scmInvocing/productInfo/forwardToProductInfo.shtml">
    				  <li  class="content_hover"><a href="${basePath}scmInvocing/productInfo/forwardToProductInfo.shtml"><i class="nav_icon_b"></i><br>商品信息</a></li>
    		</shiro:hasPermission>
    		 <shiro:hasPermission name="scmInvocing/countUnit/forwardToUnitInfo.shtml">
    		 		<li><a href="${basePath}scmInvocing/countUnit/forwardToUnitInfo.shtml"><i class="nav_icon_b"></i><br>单位设置</a></li>
    		 </shiro:hasPermission>
    		 <shiro:hasPermission name="scmInvocing/supplier/forwardToSupply.shtml">
    		 		   <li><a href="${basePath}scmInvocing/supplier/forwardToSupply.shtml"><i class="nav_icon_a"></i><br>供应商信息</a></li>
    		 </shiro:hasPermission>
    		  <shiro:hasPermission name="scmInvocing/priceManager/forwardToList.shtml">
    		 		  <li><a href="${basePath}scmInvocing/priceManager/forwardToList.shtml"><i class="nav_icon_f"></i><br>价格管理</a></li>
    		 </shiro:hasPermission>
    		   <shiro:hasPermission name="scmInvocing/scmPurOrder/findInvoPurOrder.shtml">
            	  <li><a href="${basePath}scmInvocing/scmPurOrder/findInvoPurOrder.shtml"><i class="nav_icon_b"></i><br>采购订单</a></li>
    		 </shiro:hasPermission>
    		   <shiro:hasPermission name="scmInvocing/scmPayForm/findInvoOrderPay.shtml">
           		   <li><a href="${basePath}scmInvocing/scmPayForm/findInvoOrderPay.shtml"><i class="nav_icon_b"></i><br>付款申请</a></li>
    		 </shiro:hasPermission>
   </ul>
    </div>
    <div class="content_r mt10">
    	<div class="p20">
        <div class="tab_normal mt10">
        		<div class="file_single_dl_x f14 fixed ml200">
            <form id="updateProduct" method="post" >
            <input type="hidden" name="resverseType" id="resverseType" value="${entity.resverseType}"/>
            <input type="hidden" name="pkPrdId"  id="pkPrdId" value="${entity.pkPrdId}">
            <input type="hidden" name="prdStatus"  id="prdStatus"  value=""/>
            <input type="hidden" name="weekday"  id="weekday" value=""/>
            <input type="hidden" name="month"  id="month" value=""/>
             <input type="hidden" name="hours"  id="hours" value=""/>
            <input type="hidden" name="chdCnt" id="chdCnt" value=""/>
            <input type="hidden" name="guaCnt" id="guaCnt" value=""/>
             <input type="hidden" name="incFood" id="incFood" value=""/>
            <input type="hidden" name="fkPrdcateId" id="fkPrdcateId" value=""/>
            <input type="hidden" name="fkPrdunitId" id="fkPrdunitId" value=""/>
                	 <div class="file_single_dl_x f14 fixed">
        	<dl class="fixed" style="overflow:hidden">
            	<dd><label>商品编号：</label><input type="text" class="iput_t w200"  name="pkPrdId"   id="prdId"  disabled="disabled"></dd>
            </dl>
             <dl class="fixed" style="overflow:hidden">
            	<dd><label>商品名称：</label><input type="text" class="iput_t w200"  name="prdName"   id="prdName" disabled="disabled" ><font color="#FF0000"></font>
				</dd>
            </dl>
             <dl class="fixed" style="overflow:hidden">
            		<dd><label>商品分类：</label><input type="text" class="iput_t w200"  name="cateName"  id="cateName" disabled="disabled">
					</dd>
            </dl>
			<!-- 显示动态商品结果 -->
			<div id="dynamic">
			
			
			</div>

           
            	<dl class="fixed" style="overflow:hidden">
	            	 <dd><label>商品状态：</label>
	            		 <input type="text" class="iput_t w200"  name="statusOne"  id="statusOne" disabled="disabled">
	                  </dd>
	            </dl>
            <dl class="fixed"  >
            	<dd><label>备注：</label><textarea class="textare w200"  rows="5" cols="35" name="comments" id="comments"  disabled="disabled"></textarea></dd>
            </dl>
        </div>
                   
                    <!----->
                </form>
                </div>
                </div>
                 <div class="btm_btn mt10">
                            <dl>
                                <dd><input class="btn" type="button" onclick="forwardToList();" value="返回"></dd> 
                            </dl>
                    </div>
        </div>
    </div>
</div>
<script>
	                 /*    document.getElementById("ui-upload-input").onchange=function(){
	                    document.getElementById("fkPicFile").value = this.value;
	                    } */
     </script>
<!---弹出层 成员信息编w辑--->
<div id="addfl" class="easyui-window" title="新增分类" data-options="modal:true,closed:true,iconCls:'icon-save'" style="width:400px; height:150px;position:relative;">
	<div class="editor_h1 fixed">
      <div class="editor fl">
            <ul>
                <li><label>分类名称：</label><input type="text" class="iput_t w160"></li>
            </ul>
        </div>
    </div>
    <div class="btm_btn btm_bg">
    	<dl>
        	<dd><input type="button" class="btn" onclick="$('#addfl').window('close')" value="确定"></dd>
            <dd><input type="button" class="btn" onclick="$('#addfl').window('close')" value="取消"></dd>
        </dl>
    </div>	 
</div>

</body>
</html>
